package com.bailian.snails.c_netty.serialize;

import com.bailian.snails.c_netty.serialize.impl.JSONSerializer;

/**
 * @author gaoxu
 * date: Created on 2021/11/23 5:50 下午
 */
public interface Serializer {
    // 默认解析器
    Serializer DEFAULT = new JSONSerializer();

    byte getSerializerAlogrithm();

    /**
     * java对象转换成二进制
     *
     * @param object
     * @return
     */
    byte[] serialize(Object object);


    /**
     * 二进制转换成java对象
     *
     * @param clazz
     * @param bytes
     * @param <T>
     * @return
     */
    <T> T deserialize(Class<T> clazz, byte[] bytes);

}
